<?php

namespace app\api\home;

use app\api\validate\CreateRoomValidate;
use think\facade\Log;

/**
 * 创建房间
 **/
class CreateRoom extends Base
{

    /*
     * 房间列表
     */
    public function index()
    {

        return rsJson([]);
    }

    /*
     * 创建房间
     */
    public function createRoom()
    {
        try {
            $params = $this->request->post();
            // 验证
            $result = $this->validate($params, CreateRoomValidate::class);
            if ($result !== true) {
                return rsJson([],0,$result);
            }
            $save = [
                'title' => $params['title'],
                'rank'   => $params['rank'],
                'snatchingWheatTime' =>  $params['rank'],
            ];
            return rsJson();
        } catch (\Exception $e) {
            Log::info('LiveCreateError:'.$e->getMessage());
            return rsJson([],0,'服务异常');
        }
    }

}